<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets or gets the path for a domain</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.bind-textdomain-codeset.html">« bind_textdomain_codeset</a></li>
      <li style="float: right;"><a href="function.dcgettext.html">dcgettext »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.gettext.html">Gettext 函数</a></li>
    <li>Sets or gets the path for a domain</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.bindtextdomain" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">bindtextdomain</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">bindtextdomain</span> &mdash; <span class="dc-title">Sets or gets the path for a domain</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.bindtextdomain-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>bindtextdomain</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$domain</code></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$directory</code></span>): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   The <span class="function"><strong>bindtextdomain()</strong></span> function sets or gets the path
   for a domain.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.bindtextdomain-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">domain</code></dt>

     <dd>

      <p class="para">
       The domain.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">directory</code></dt>

     <dd>

      <p class="para">
       The directory path.
       An empty string means the current directory.
       If <strong><code>null</code></strong>, the currently set directory is returned.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.bindtextdomain-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The full pathname for the <code class="parameter">domain</code> currently being set,
    或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.bindtextdomain-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.3</td>
      <td>
       <code class="parameter">directory</code> is nullable now.
       Previously, it was not possible to retrieve the currently set directory.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.bindtextdomain-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2265">
    <p><strong>示例 #1 <span class="function"><strong>bindtextdomain()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$domain&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'myapp'</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">bindtextdomain</span><span style="color: #007700">(</span><span style="color: #0000BB">$domain</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/usr/share/myapp/locale'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
/usr/share/myapp/locale
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.bindtextdomain-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    The <span class="function"><strong>bindtextdomain()</strong></span> information is maintained per process,
    not per thread.
   </p>
  </p></blockquote>
 </div>

</div></div></div></body></html>